/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "S_物体.h"



enum E_投影模式 {
	e_透视,
	e_正交,
};


struct S_摄像机 : public S_物体 {
	Mat44	    m_相机位置矩阵;
	//Mat44f	m_相机位置矩阵;
	Mat44	    m_相机投影;
	S_板载缓存* m_投影矩阵;

	ivec2	m_分辨率;
	float32	m_宽高比;
	float32	m_视角;
	vec2	m_近远端;

	vec3		m_视点;
	vec3		m_眼睛偏移;
	vec3		m_上方向;
	vec3		m_缩放;
	float32		m_视点距离;
	vec2		m_正交边界;
	E_投影模式	m_投影模式;

	

	S_摄像机(S_设备环境& ctx);

	//探针;
	void	f_add后期效果();
	void	f_clear后期效果();


	void	f_set雾颜色(vec4 color);
	void	f_set雾模式(uint8 模式);
	void	f_set雾区间(vec2);
	void	f_set视野(float32 FOV);

	void	f_LookAt(const vec3& eye, const vec3& t, const vec3& up);
	void	f_set透视投影(float32 角度, float32 宽高比, const vec2& 近远端);
	void	f_set正交投影(const vec2& size);
	//void	f_set旋转(float32 x, float32 y, float32 z);
	//void	f_set缩放(float32 x, float32 y, float32 z);

	void	f_set位置(float32 x, float32 y, float32 z);
	void	f_set累加旋转(float32 x, float32 y, float32 z);
	void	f_set缩放(float32 x, float32 y, float32 z);
	void	f_set视点偏移(vec3);



	vec4	f_get雾颜色();
	uint8	f_get雾模式();
	vec2	f_get雾区间();
	float32	f_get视野();



	void	f_set视角(float32 r);
	void	f_set宽高比(vec2 view);
	void	f_Update(Mat44f* c);
	void	f_绘制();


protected:
	std::vector<Mat44f> m_相机矩阵;

private:
	S_设备环境 m_Ctx;

	

};




Mat44f f_camera_计算旋转矩阵(const S_摄像机& camera, bool 是否逆);










